import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 饿了么引入
import { globalRegister } from '@/plugins'
import { ElMessage } from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// 全局组件引入
import Header from '@/components/Header'
import Footer from '@/components/Footer'
import SearchNav from '@/components/SearchNav'
import RankingList from '@/components/RankingList'
import Pagination from '@/components/Pagination'
// tabs选项卡,sort排序,楼盘列表组件
import TabSortBuildingList from '@/components/TabSortBuildingList'

// 引入swiper
import 'swiper/swiper-bundle.min.css'
// 引入mitt库
import mitt from 'mitt'

const app = createApp(App)
app.use(store)
app.use(router)
// 饿了么ui注册
app.use(globalRegister)
// icon注册
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.config.globalProperties.$message = ElMessage
app.config.globalProperties.$mybus = mitt()

// 全局组件注册
app.component(Header.name, Header)
app.component(Footer.name, Footer)
app.component(SearchNav.name, SearchNav)
app.component(RankingList.name, RankingList)
app.component(Pagination.name, Pagination)
app.component(TabSortBuildingList.name, TabSortBuildingList)

app.mount('#app')
